#define ElemType int

typedef struct ListNode List_Node;

#include "common.h"

char* addStrings(char* num1, char* num2);

char* reverse(char* str);

int main()
{
	return 0;
}

char* reverse(char* str);

char* addStrings(char* num1, char* num2)
{
	int len1 = strlen(num1), len2 = strlen(num2);
	if (len1 < len2) {
		char* temp = num1;
		num1 = num2, num2 = temp;
		int len = len1;
		len1 = len2, len2 = len;
	}
	char* res = calloc(len1 + 2, sizeof(char));

	int carry = 0, size = 0;
	for (int i = len2 - 1, j = len1 - 1; i >= 0; i--, j--) {
		int op1 = num1[j] - '0', op2 = num2[i] - '0';
		int digit = op1 + op2 + carry;
		res[size++] = '0' + digit % 10;
		carry = digit / 10;
	}

	for (int i = len1 - len2 - 1; i >= 0; i--) {
		int op = num1[i] - '0';
		int digit = op + carry;
		res[size++] = '0' + digit % 10;
		carry = digit / 10;
	}

	if (carry) res[size] = '1';
	return reverse(res);
}

char* reverse(char* str)
{
	int len = strlen(str);
	for (int i = 0, len_ = len >> 1; i < len_; i++) {
		char tmp = str[i];
		str[i] = str[len - 1 - i];
		str[len - 1 - i] = tmp;
	}
	return str;
}